package com.iv.durian.cloud.facade.support;

import com.iv.durian.cloud.Banner;
import com.iv.durian.cloud.facade.BannerFacade;
import com.iv.durian.cloud.service.BannerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/service/banner")
public class BannerFacadeImpl implements BannerFacade {

    @Autowired
    private BannerService bannerService;

    @Override
    public List<Banner> list(@PathVariable("type") Integer type,@PathVariable("type") Integer status) {
        return bannerService.list(type, status);
    }

    @Override
    public Banner get(@PathVariable("bannerId") Integer bannerId) {
        return bannerService.get(bannerId);
    }

    @Override
    public void add(@RequestBody  Banner banner) {
        bannerService.add(banner);
    }

    @Override
    public int remove(@PathVariable("bannerId") Integer bannerId) {
        return bannerService.remove(bannerId);
    }

    @Override
    public int count(@PathVariable("type") Integer type,@PathVariable("type") Integer status) {
        return bannerService.count(type, status);
    }

    @Override
    public void update(@RequestBody Banner banner){
        bannerService.update(banner);
    }
}
